<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/20 17:34
 * Note: 公共控制器
 */
namespace Admin\Controller;
use Think\Controller;
class CommonController extends Controller {
    //登录者id
    protected $admin_id;

    public function __construct(){
        parent::__construct();

        //session初始化
        session(array('name'=>'session_id','expire'=>3600,'prefix'=>SESSION_PREFIX));

       if ( !session('?adminInfo.admin_id') ) {
            $this->admin_id = session('adminInfo.admin_id');
       }

        $uname = M('User')->where('id = 1')->getField('username');
        $this->assign('uname',$uname);
        //系统信息
        $info = M('System')->where('id = 1')->find();
        $this->assign('web',$info['title']);
        $this->assign('url',$info['url']);
        $this->assign('keywords',$info['keywords']);
        $this->assign('desc',$info['desc']);

    }
}